package com.zhanghp.object;

import com.zhanghp.visitor.CompanyVisitor;
import com.zhanghp.visitor.LeaderVisitor;
import lombok.extern.slf4j.Slf4j;

/**
 * 领导
 *
 * @author zhanghp
 * @date 2022-08-16 15:07
 */
@Slf4j
public class Leader implements Company{
    @Override
    public void accept(CompanyVisitor visitor) {
        if (visitor instanceof LeaderVisitor) {
            ((LeaderVisitor) visitor).visit(this);
        }else {
            log.warn("Only LeaderVisitor is allowed to visit the Leader, your visitor identity is {}", visitor);
        }
    }

    @Override
    public String toString() {
        return " --> Leader <-- ";
    }
}
